﻿app.factory('messageFactory', function ($http) {
    $http.defaults.useXDomain = true;
    var factory = {};

    factory.getMessageByFriend = function(id) {
        return $http.get(getMessageByUserApiAddress + id);
    };
    factory.getMessageByRoom = function (id) {
        return $http.get(getMessageByRoomApiAddress + id);
    };
    factory.addMessage = function (dataPost) {
        return $http.post(postMessageApiAddress, dataPost);
    };
    factory.delAllChatInRoom = function (id) {
        return $http.post(delAllMessageInRoomApiAddress + id);
    };
    factory.delMessage= function (id) {
        return $http.post(delMessageApiAddress + id);
    };
    return factory;
});

